home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / lang / c--c0202 / file.h-- < prev    next >
Encoding:
Text File  |  1993-12-26  |  3.8 KB  |  153 lines

  1. /*
  2.     SPHINX Programming (C) 1993.
  3.     NAME:  FILE.H--
  4.     DESCRIPTION:  File related constant definitions and procedures.
  5.     LAST MODIFIED:  26 Dec 1993
  6.     PROCEDURES DEFINED IN THIS FILE:
  7.         : word appendfile(filename,bufsegment,bufoffset,bytes)
  8.         : word close(filehandle)
  9.         : word create(filename,attribute)
  10.         : word open(filename,byte mode)
  11.         : word read(filehandle,bufferoffset,bytes)
  12.         : word readfar(filehandle,bufferseg,bufferoffset,bytes)
  13.         : word readfile(filename,bufseg,bufoff,bytes)
  14.         : word write(filehandle,bufferoffset,bytes)
  15.         : word writefar(filehandle,bufferseg,bufferoffset,bytes)
  16.         : word writefile(filename,bufseg,bufoff,bytes)
  17. */
  18.  
  19.  
  20. /*** file access constansts for use with open() and FOPEN() ***/
  21.  
  22. enum { F_READ, F_WRITE, F_READWRITE };
  23.  
  24.  
  25. /*** file attribute constants for use with create() and FCREATE() ***/
  26.  
  27. ?define  FA_NORMAL     0x00
  28. ?define  FA_READONLY   0x01
  29. ?define  FA_HIDDEN     0x02
  30. ?define  FA_SYSTEM     0x04
  31. ?define  FA_VOLUME     0x08
  32. ?define  FA_DIRECTORY  0x10
  33. ?define  FA_ARCHIVE    0x20
  34.  
  35.  
  36. /*** standard input, output, error, auxilary and printer file handles ***/
  37.  
  38. ?define  STDIN    0
  39. ?define  STDOUT   1
  40. ?define  STDERR   2
  41. ?define  STDAUX   3
  42. ?define  STRPRN   4
  43.  
  44.  
  45. /****** procedure definitions ******/
  46.  
  47.  
  48. : word open (word filename; byte mode)
  49. {
  50. ?DOSrequired 0x200
  51. AL = mode;
  52. DX = filename;
  53. AH = 0x3D;
  54. $INT 0x21
  55. IF( CARRYFLAG )
  56.     AX = 0;
  57. }
  58.  
  59.  
  60. : word create (word filename, attribute)
  61. {
  62. ?DOSrequired 0x200
  63. CX = attribute;
  64. DX = filename;
  65. AH = 0x3C;
  66. $INT 0x21
  67. IF( CARRYFLAG )
  68.     AX = 0;
  69. }
  70.  
  71.  
  72. : word close (word filehandle)
  73. {
  74. ?DOSrequired 0x200
  75. BX = filehandle;
  76. AH = 0x3E;
  77. $INT 0x21
  78. IF( NOTCARRYFLAG )
  79.     AX = 0;
  80. }
  81.  
  82.  
  83. : word readfile (word filename,bufseg,bufoff,bytes)
  84. inline
  85. {?DOSrequired 0x0200
  86. $ DB 0x55,0x89,0xE5,0x36,0x8B,0x56,0xA,0xB8,0x0,0x3D,
  87.      0xCD,0x21,0x73,0x6,0x31,0xC0,0x5D,0xC2,0x8,0x0,
  88.      0x89,0xC3,0x36,0x8B,0x46,0x8,0x1E,0x8E,0xD8,0x36,
  89.      0x8B,0x56,0x6,0x36,0x8B,0x4E,0x4,0xB4,0x3F,0xCD,
  90.      0x21,0x73,0x2,0x31,0xC0,0x89,0xC2,0xB4,0x3E,0xCD,
  91.      0x21,0x89,0xD0,0x1F,0x5D,0xC2,0x8,0x0
  92. }
  93.  
  94.  
  95. : word appendfile (word filename,bufsegment,bufoffset,bytes)
  96. inline
  97. {?DOSrequired 0x0200
  98. $ DB 0x55,0x8B,0xEC,0x36,0x8B,0x56,0xA,0xB8,0x1,0x3D,
  99.      0xCD,0x21,0x73,0xE,0xB4,0x3C,0x33,0xC9,0xCD,0x21,
  100.      0x73,0x6,0x33,0xC0,0x5D,0xC2,0x8,0x0,0x89,0xC3,
  101.      0xB8,0x2,0x42,0x33,0xC9,0x33,0xD2,0xCD,0x21,0x72,
  102.      0x15,0x36,0x8B,0x46,0x8,0x1E,0x8E,0xD8,0x36,0x8B,
  103.      0x56,0x6,0x36,0x8B,0x4E,0x4,0xB4,0x40,0xCD,0x21,
  104.      0x73,0x2,0x33,0xC0,0x8B,0xD0,0xB4,0x3E,0xCD,0x21,
  105.      0x89,0xD0,0x1F,0x5D,0xC2,0x8,0x0
  106. }
  107.  
  108.  
  109. : word writefile (word filename,bufseg,bufoff,bytes)
  110. inline
  111. {?DOSrequired 0x0200
  112. $ DB 0x55,0x89,0xE5,0x36,0x8B,0x56,0xA,0xB4,0x3C,0x31,
  113.      0xC9,0xCD,0x21,0x73,0x6,0x31,0xC0,0x5D,0xC2,0x8,
  114.      0x0,0x89,0xC3,0x36,0x8B,0x46,0x8,0x1E,0x8E,0xD8,
  115.      0x36,0x8B,0x56,0x6,0x36,0x8B,0x4E,0x4,0xB4,0x40,
  116.      0xCD,0x21,0x73,0x2,0x31,0xC0,0x89,0xC2,0xB4,0x3E,
  117.      0xCD,0x21,0x89,0xD0,0x1F,0x5D,0xC2,0x8,0x0
  118. }
  119.  
  120.  
  121. : word read (word filehandle,bufferoffset,bytes)
  122. inline
  123. {?DOSrequired 0x0200
  124. $ DB 0x5F,0x59,0x5A,0x5B,0xB4,0x3F,0xCD,0x21,0x73,0x2,
  125.      0x31,0xC0,0xFF,0xE7
  126. }
  127.  
  128.  
  129. : word readfar (word filehandle,bufferseg,bufferoffset,bytes)
  130. inline
  131. {?DOSrequired 0x0200
  132. $ DB 0x5F,0x59,0x5A,0x8C,0xDE,0x1F,0x5B,0xB4,0x3F,0xCD,
  133.      0x21,0x73,0x2,0x31,0xC0,0x8E,0xDE,0xFF,0xE7
  134. }
  135.  
  136.  
  137. : word write (word filehandle,bufferoffset,bytes)
  138. inline
  139. {?DOSrequired 0x0200
  140. $DB 0x5F,0x59,0x5A,0x5B,0xB4,0x40,0xCD,0x21,0x73,0x2,
  141.     0x31,0xC0,0xFF,0xE7
  142. }
  143.  
  144.  
  145. : word writefar (word filehandle,bufferseg,bufferoffset,bytes)
  146. inline
  147. {?DOSrequired 0x0200
  148. $DB 0x5F,0x59,0x5A,0x8C,0xDE,0x1F,0x5B,0xB4,0x40,0xCD,
  149.     0x21,0x73,0x2,0x31,0xC0,0x8E,0xDE,0xFF,0xE7
  150. }
  151.  
  152.  
  153. /* end of FILE.H-- */